package cate.common.table.item.gem.row;

import cate.common.table.EExcelNoteField;
import cate.common.table.EExcelRowClass;
import cate.common.table.ERow;
import cate.common.table.item.IBagItemTpl;
import cp.solution.util.str.Str;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

@EExcelRowClass(IDTitle = "宝石ID")
public class GemBaseRow extends ERow implements IBagItemTpl {
    @EExcelNoteField(fieldName = "宝石部位")
    public byte pos;
    @EExcelNoteField(fieldName = "等级")
    public int level;
    @EExcelNoteField(fieldName = "属性")
    public String attrStr;
    @EExcelNoteField(fieldName = "特殊属性")
    public String speAttrStr;
    @EExcelNoteField(fieldName = "技能")
    public int skillId;
    @EExcelNoteField(fieldName = "分解返还")
    public String backStr;
    @EExcelNoteField(fieldName = "宝石名称")
    public String name;
    @EExcelNoteField(fieldName = "进阶产出宝石")
    public int gradeTid;
    @EExcelNoteField(fieldName = "是否进阶宝石")
    public boolean isGradeGem;
    @EExcelNoteField(fieldName = "进阶消耗资源")
    public String gradeConsumeStr;
    @EExcelNoteField(fieldName = "技能生效职业")
    private String effectJobStr;
    @EExcelNoteField(fieldName = "是否公告")
    public boolean announce;
    @EExcelNoteField(fieldName = "重铸返还")
    public String reforgeRewardStr;
    @EExcelNoteField(fieldName = "合成消耗宝石")
    private String compositeConsumeStr;
    @EExcelNoteField(fieldName = "合成消耗资源")
    public String compositeItemConsumeStr;
    @EExcelNoteField(fieldName = "宝石原型ID")
    public int protoId;

    public List<Integer> compositeConsumes;
    public List<Byte> effectJobs;

    @Override
    public void decode(){
        effectJobs = new ArrayList<>();
        if (StringUtils.isNotBlank(effectJobStr)) {
            effectJobs = Str.str2ByteList(effectJobStr, "#");
        }
        compositeConsumes = new ArrayList<>();
        if (StringUtils.isNotBlank(compositeConsumeStr)) {
            compositeConsumes = Str.str2IntList(compositeConsumeStr, "#");
        }
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public int getTemplateId() {
        return id;
    }

    @Override
    public long getPileMax() {
        return 999;
    }

    @Override
    public boolean unique() {
        return false;
    }
}
